#ifndef CHAT_UI_H
#define CHAT_UI_H
#include"chat_client.h"
#include <QObject>
#include <QWidget>
#include <QPushButton>
#include <QLineEdit>
#include <QLabel>
#include <QTextBrowser>
#include <QListWidget>
class chat_ui : public QWidget
{
    Q_OBJECT
public:
    explicit chat_ui(QWidget *parent = nullptr);

private:
    void initLayout();
    void connectInit();

private:
    chat_client* Client;

private:
    //查看文件按钮
    QPushButton *viewFilesBtn;
    //文件列表
    QListWidget *fileListWidget;

    QPushButton *send_txt_btn;
    QPushButton *send_file_btn;
    QPushButton* connect_btn;
    QLineEdit *txt_line;
    QLineEdit *ip_line;
    QLineEdit *port_line;
    QLineEdit *id_line;
    QLabel* ip_lab;
    QLabel* port_lab;
    QLabel* id_lab;
    QTextBrowser* text_browser;
signals:

private slots:

    //文件相关
    void viewFilesBtnClicked();
    void fileSelected();
    void filedownloaded_slot(const QString &filename,const QString &savepath);;
    //消息相关
    void pritTobrowser(QString msg);
    void send_txt_btn_clicked_slot();
    void send_file_btn_clicked_slot();
    void connect_btn_clicked_slot();
};

#endif // CHAT_UI_H
